package valeria;

import java.util.Scanner;

public class J10SungJuk {
	public static void main(String[] args) {
		// return을 이용한 메서드
		//주의:Scanner클래스를 이용해서 입력처리하고
		//close()를 하게되면 다시 Scanner생성불가!
		String name;
		// String name[]=new String[2];
		int kor, eng, mat, tot;
		// int point[]=new int[3+1];//3과목+배열의 index가
		// 0부터시작하기에1
		double avg;
		char grd;

		name = inputName(makeScanner());
		kor = inputKor(makeScanner());
		eng = inputEng(makeScanner());
		mat = inputMat(makeScanner());
		tot = getTotal(kor, eng, mat);
		avg = getAverage(tot);
		grd = getGrade(avg);

		System.out.println(name);
		System.out.println(kor);
		System.out.println(eng);
		System.out.println(mat);
		System.out.println(tot);
		System.out.println(avg);
		System.out.println(grd);

	}// main
//Scanner 생성
	public static Scanner makeScanner(){
	Scanner sc=new Scanner(System.in);
		return sc;
	}
	
	private static int inputMat(Scanner sc) {
		int mat;
		System.out.println("수학점수는?");
		mat = sc.nextInt();
		
		return mat;
	}

	private static int inputEng(Scanner sc) {
		int eng;
		System.out.println("영어점수는?");
		eng = sc.nextInt();
		
		return eng;
	}

	private static int inputKor(Scanner sc) {
		int kor;
		
		System.out.println("국어점수는?");
		kor=sc.nextInt();
		
		return kor;
	}

	private static String inputName(Scanner sc) {
		String name;
		System.out.println("이름은?");
		name = sc.next();
		
		return name;

	}

	private static char getGrade(double avg) {
		char grd;
		switch ((int) avg / 10) {
		case 10:
		case 9:
			grd = '수';
			break;
		case 8:
			grd = '우';
			break;
		case 7:
			grd = '미';
			break;
		case 6:
			grd = '양';
			break;
		default:
			grd = '가';
			return grd;
		}
		return grd;
	}

	private static double getAverage(int tot) {
		double avg;
		avg = (double) tot / 3;
		return avg;
	}

	private static int getTotal(int kor, int eng, int mat) {
		int tot;
		tot = kor + eng + mat;
		return tot;

	}

}
